{extend name="common:frm_base" /}
{block name="content"}
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-header">讲堂管理</div>
        <div class="layui-card-body" style="padding: 15px;">
            <form class="layui-form" action="{:url('forum/handle')}" lay-filter="component-form-group">
                <div class="layui-form-item">
                    <label class="layui-form-label">标题</label>
                    <div class="layui-input-block">
                        <input type="text" value="{$info.title|default=''}" name="title" lay-verify="required" placeholder="请输入" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <!--<div class="layui-form-item">-->
                    <!--<label class="layui-form-label">分类</label>-->
                    <!--<div class="layui-input-block" style="position: relative;z-index: 10002;">-->
                        <!--<select  name="cate_id">-->
                            <!--<option value="">请选择类型</option>-->
                            <!--{foreach $cate_list as $key=>$val}-->
                                <!--<option value="{$val->id}" {if $info->cate_id == $val->id}selected{/if} >{$val['name']}</option>-->
                            <!--{/foreach}-->
                        <!--</select>-->
                    <!--</div>-->
                <!--</div>-->
<!--                <div class="layui-form-item">-->
<!--                    <label class="layui-form-label">地址</label>-->
<!--                    <div class="layui-input-block">-->
<!--                        <input type="text" value="{$info.address|default=''}" name="address" lay-verify="required" placeholder="请输入" autocomplete="off" class="layui-input">-->
<!--                    </div>-->
<!--                </div>-->
<!--                <div class="layui-form-item">-->
<!--                    <label class="layui-form-label">人数</label>-->
<!--                    <div class="layui-input-block">-->
<!--                        <input type="text" value="{$info.number|default=''}" name="number" lay-verify="required" placeholder="请输入" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')" autocomplete="off" class="layui-input">-->
<!--                    </div>-->
<!--                </div>-->
<!--                <div class="layui-form-item">-->
<!--                    <label class="layui-form-label">类型</label>-->
<!--                    <div class="layui-input-block" style="position: relative;z-index: 10001;">-->
<!--                        <select  name="type_name">-->
<!--                            <option value="室内" {if $info.type_name=='室内'}selected{/if}>室内</option>-->
<!--                            <option value="室外" {if $info.type_name=='室外'}selected{/if}>室外</option>-->
<!--                        </select>-->
<!--                    </div>-->
<!--                </div>-->
<!--                <div class="layui-form-item">-->
<!--                    <label class="layui-form-label">时间</label>-->
<!--                    <div class="layui-input-block" style="position: relative;z-index: 10000;">-->
<!--                        <input type="text" name="use_time" class="layui-input" value="{$info.use_time}" id="use_time">-->
<!--                    </div>-->
<!--                </div>-->
                <div class="layui-form-item">
                    <label class="layui-form-label">图片</label>
                    <div class="layui-input-block" style="display:flex;">
                        <div style="width:100px;height:100px;border:1px solid #e0e0e0;">
                            <img id="bus_img_btn" style="width:100px;height:100px;" src="{if $info.thumb}{$info.thumb}{else /}/add.jpg{/if}" id="up_img">
                        </div>
                        <input type="hidden" id="thumb" value="{$info.thumb}" name="thumb">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">腾讯视频VID</label>
                    <div class="layui-input-block">
                        <input type="text" value="{$info.vid|default=''}" name="vid" placeholder="请输入" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item layui-form-text">
                    <label class="layui-form-label">内容</label>
                    <div class="layui-input-block">
                        <!--<textarea name="content" placeholder="请输入内容" class="layui-textarea"></textarea>-->
                        <script id="container" name="content" type="text/plain">{$info->content | raw}</script>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">状态</label>
                    <div class="layui-input-inline">
                        <input type="checkbox" name="status" {if $info.status==1 }checked{/if} lay-skin="switch" value="1" lay-text="ON|OFF">
                    </div>
                </div>
                {:token()}
                <input type="hidden" value="{$act}" name="act" />
                <input type="hidden" value="{$info['id']|default=''}" name="id" />
                <div class="layui-form-item layui-hide">
                    <input type="button" lay-submit lay-filter="LAY-user-front-submit" id="LAY-user-front-submit" value="确认">
                </div>
                <!--<div class="layui-form-item layui-layout-admin">-->
                <!--<div class="layui-input-block">-->
                <!--<div class="layui-footer" style="left: 0;">-->
                <!--<button class="layui-btn" lay-submit="" lay-filter="component-form-demo1">立即提交</button>-->
                <!--<button type="reset" class="layui-btn layui-btn-primary">重置</button>-->
                <!--</div>-->
                <!--</div>-->
                <!--</div>-->
            </form>
        </div>
    </div>
</div>
<!-- 配置文件 -->
<script type="text/javascript" src="__COMMON__/ueditor/ueditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="__COMMON__/ueditor/ueditor.all.js"></script>
<!-- 实例化编辑器 -->
<script type="text/javascript">
    var ue = UE.getEditor('container',{
        initialFrameHeight : 500
    });
</script>
<script>
    layui.config({
        base: '__LAYUIADMIN__/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'form', 'laydate', 'upload'], function(){
        var $ = layui.$
            ,admin = layui.admin
            ,element = layui.element
            ,layer = layui.layer
            ,laydate = layui.laydate
            ,form = layui.form
            ,upload = layui.upload;

        //执行一个laydate实例
        laydate.render({
            type: 'datetime',
            elem: '#use_time' //指定元素
        });
        form.render(null, 'component-form-group');

        laydate.render({
            elem: '#begin_time'
            ,type: 'date'
        });


        var uploadInst = upload.render({
            elem: '#bus_img_btn'
            , url: "{:url('common/upload_img')}"
            , data: {name:'forum'}
            , accept: 'images'
            , acceptMime: 'image/*,image/gif'
            , done: function (res) {
                $('#bus_img_btn').attr('src',res.data.img);
                $('#thumb').val(res.data.img);
            }
            , error: function () {
            }
        });

        $('#pic-list').viewer();

        $(".demo-reload").click(function () {
            $(this).parents('.layui-col-xs3').remove();//模拟前端删除按钮
            var img_urls = [];
            $(".layui-upload-img").each(function () {
                img_urls.push($(this).attr("data-src"));
            });
            $("#img_url").val(img_urls);
        });

        form.render(null, 'component-form-group');



    });

    function openImg(i) {
        layer.photos({
            photos: '#pic-list'
        });
    }
</script>
{/block}